const StatusCodes = {
  "0": "success",
  "99": "系统不知道的错误",
  "00": "打开蓝牙适配器失败",
  "01": "没有连接代理",
  "02": "蓝牙没有打开",
  "03": "设备uuid不存在",
  "04": "蓝牙已断开",
  "05": "系统版本低于 4.3 不支持 BLE",
  "06": "连接蓝牙失败",
  "07": "蓝牙已经连接",
  "08": "蓝牙连接超时",
  "09": "no service",
  "10": "no characteristic"
}
function getResponseMessage() {
  if (arguments.length == 1) return { code: arguments[0], message: StatusCodes[arguments[0]]};
  if (arguments.length == 2) {
    if (typeof (arguments[1]) == "string") {
      return { code: arguments[0], message: arguments[1] };
    }
    if (typeof (arguments[1]) == "object") {
      return { code: arguments[0], data: arguments[1] };
    }
  }
  if (arguments.length == 3) return { code: arguments[0], message: arguments[1], data: arguments[2] };
}

module.exports = {
  getResponseMessage: getResponseMessage,
};